﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using University.Workshop.Model;
using University.Workshop.Business;
using University.Workshop.Presenters.AppointmentFolder;

namespace University.Workshop.WinApp
{
    public partial class GetAppointmentesTodayByDoctor : Form, IAppointmentsToday
    {
        string currentDate;
        string currentDateActual;
        DateTime date = DateTime.Today;
        User loggedUser;
        PresenterGetAppointmentsToday presenter;
        List<Appointment> appointments;

        public GetAppointmentesTodayByDoctor()
        {
            InitializeComponent();
            presenter = new PresenterGetAppointmentsToday(this);
            currentDateActual = date.ToString("dd/MM/yyyy");
            currentDate = date.ToString("M/dd/yyyy");
        }

        public GetAppointmentesTodayByDoctor(User user)
        {
            InitializeComponent();
            presenter = new PresenterGetAppointmentsToday(this);
            currentDateActual = date.ToString("dd/MM/yyyy");
            currentDate = date.ToString("M/dd/yyyy");
            loggedUser = user;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            appointments = (List<Appointment>)presenter.ObtainAppointmentsToday();
            dataAppointments.DataSource = appointments;
        }

        #region Miembros de IAppointmentsToday

        string IAppointmentsToday.DoctorId
        {
            get
            {
                return loggedUser.UserId;
            }
            set
            {
                throw new NotImplementedException();
            }
        }

        string IAppointmentsToday.DateToday
        {
            get
            {
                return currentDate;
            }
            set
            {
                throw new NotImplementedException();
            }
        }

        #endregion

        private void GetAppointmentesTodayByDoctor_Load(object sender, EventArgs e)
        {
            label2.Text = loggedUser.LastName;
            label4.Text = currentDateActual;
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
